package com.jxmcloud.business.cut.service.impl.database;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jxmcloud.business.cut.mapper.database.IGoodsPoolRecordDBMapper;
import com.jxmcloud.business.cut.model.database.DBGoodsPoolRecord;
import com.jxmcloud.business.cut.model.query.GoodsPoolRecordQuery;
import com.jxmcloud.business.cut.service.database.IGoodsPoolRecordDBService;
import com.jxmcloud.business.cut.vo.GoodsPoolRecordVo;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class GoodsPoolRecordDBServiceImpl extends ServiceImpl<IGoodsPoolRecordDBMapper, DBGoodsPoolRecord> implements IGoodsPoolRecordDBService {
    @Override
    public boolean insertIntoData(DBGoodsPoolRecord info) {
        return this.baseMapper.insert(info) == 1;
    }

    @Override
    public DBGoodsPoolRecord selectOne(Integer uid) {
        return this.baseMapper.selectById(uid);
    }

    @Override
    public List<DBGoodsPoolRecord> selectAll(List<Integer> uid) {
        QueryWrapper<DBGoodsPoolRecord> wrapper = new QueryWrapper<>();
        wrapper.in("id", uid);
        return this.baseMapper.selectList(wrapper);
    }

    @Override
    public boolean deleteData(Integer uid) {
        return this.baseMapper.deleteById(uid) == 1;
    }

    @Override
    public boolean updateData(DBGoodsPoolRecord info) {
        return this.baseMapper.updateById(info) == 1;
    }

    @Override
    public IPage<GoodsPoolRecordVo> getGoodsPoolRecordPage(GoodsPoolRecordQuery query) {
        return this.baseMapper.selectGoodsPoolRecordPage(query);
    }
}
